package com.gagakuai.demo.aop.early;

import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
 * @program: settement
 * @description:
 * @author: houhong
 * @create: 2022-11-13 16:14
 */
@Configuration
public class MainConfig {

    @Bean
    public EarglyLogAspect earglyLogAspect() {
        return new EarglyLogAspect();
    }

    @Bean
    public LogInterceptor logInterceptor() {

        return new LogInterceptor();
    }

    @Bean
    public TestUseImpl testUse() {

        return new TestUseImpl();
    }

    @Bean
    public ProxyFactoryBean userProxy() {

        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setInterceptorNames("earglyLogAspect", "logInterceptor");
        proxyFactoryBean.setTarget(testUse());
        return proxyFactoryBean;
    }
}